home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 4 / FM Towns Free Software Collection 4 - Disc 1.iso / t_os / mricon / source / bios.asm next >
Encoding:
Assembly Source File  |  1991-10-19  |  12.6 KB  |  793 lines

  1.         .286p
  2. _TEXT        SEGMENT  DWORD PUBLIC 'CODE'
  3. _TEXT        ENDS
  4. _DATA        SEGMENT  WORD PUBLIC 'DATA'
  5. _DATA        ENDS
  6. CONST        SEGMENT  WORD PUBLIC 'CONST'
  7. CONST        ENDS
  8. _BSS        SEGMENT  WORD PUBLIC 'BSS'
  9. _BSS        ENDS
  10. DGROUP        GROUP     _TEXT, CONST,    _BSS,    _DATA
  11.  
  12.         ASSUME  CS: _TEXT, DS: DGROUP, ES: DGROUP
  13.  
  14. extrn        _CHK_VRAM:BYTE
  15. extrn        _ACT_DSP:BYTE
  16. extrn        _ACT_CVRAM:WORD
  17. extrn        _ACT_KVRAM:WORD
  18. extrn       _CUR_OLD_XY:WORD
  19. extrn        _CUR_DISP_X:WORD
  20. extrn        _CUR_DISP_Y:WORD
  21. extrn        _CUR_DISP_OFF:WORD
  22. extrn        _CUR_DISP_SIZ:WORD
  23. extrn        _CUR_DISP_FLG:BYTE
  24. extrn        term_flg:BYTE
  25. extrn        vdb_act_flg:BYTE
  26.  
  27. extrn        _BIOS_91:NEAR
  28. extrn       oak_set:near
  29. extrn       oak_reset:near
  30. extrn        Term_in_out:near
  31.  
  32. GVRAM        equ    0C000h
  33. CVRAM        equ    0C800h
  34. KVRAM        equ    0CA00h
  35. ANKCG        equ    0CB00h
  36.  
  37. MAX_X        equ    80
  38. MAX_Y        equ    24
  39. MAX_Y2        equ    25
  40. CHRSIZ        equ    16
  41. LINSIZ        equ    16
  42.  
  43. _DATA        segment
  44. consol_path    db    "CON",0            ; コンソ-ルデバイス名
  45. null_path    db    "NUL",0            ; NULデバイス名
  46. _DATA        ends
  47.  
  48. _TEXT        SEGMENT
  49.  
  50. ;*****************************
  51. ;*    Work Vram Eria
  52. ;****************************
  53. dmy_ram        dw    (MAX_X*MAX_Y2) dup(0)
  54. ;*****************************
  55. ;*    割り込みワ-ク
  56. ;*****************************
  57. ds_bak        dw    ?
  58. es_bak        dw    ?
  59. vct_off        dw    ?
  60. vct_seg        dw    ?
  61. ;*********************
  62. ;*    VSYNC
  63. ;*********************
  64. IRQ_CODE     equ    0Bh
  65. VS_TIME        equ    4        ; 画面更新間隔の設定
  66.  
  67. vs_para        db    0,0
  68. vs_off        dw    ?
  69. vs_seg        dw    ?
  70. old_off        dw    ?
  71. old_seg        dw    ?
  72. irq_map        db    0,0,0,0
  73. vs_cnt        db    0
  74.  
  75. int_ent     proc    far
  76.         mov    dx,05CAh
  77.         out    dx,al
  78.  
  79.         inc    cs:[vs_cnt]
  80.         cmp    cs:[vs_cnt],VS_TIME
  81.         jb    int_rt
  82.         mov    cs:[vs_cnt],0
  83.  
  84.         mov    ds,cs:[ds_bak]
  85.         mov    es,cs:[es_bak]
  86.  
  87.         cmp    byte ptr [_ACT_DSP],0    ;割り込み禁止フラグ
  88.         jne    int_rt
  89.         mov    byte ptr [_ACT_DSP],1
  90.         sti
  91.  
  92. ;        cmp    byte ptr [term_flg],0
  93. ;        je    Non_Term_chk
  94.         cmp    byte ptr [vdb_act_flg],0
  95.         jne    Non_Term_chk
  96.  
  97.         call    Term_in_out
  98.  
  99. Non_Term_chk:    mov    dx,05C8h
  100.         in    al,dx
  101.         test    al,80h
  102.         jnz    int_go
  103.  
  104.         mov    ah,byte ptr [_CUR_DISP_X]
  105.         mov    al,byte ptr [_CUR_DISP_Y]
  106.         cmp    ax,[_CUR_OLD_XY]
  107.         jnz    int_go
  108.  
  109.         cmp    byte ptr [_CHK_VRAM],0
  110.         jz    int_rt_2
  111.  
  112. int_go:        call    _cflush
  113.  
  114.         mov    byte ptr [_CHK_VRAM],0
  115.         mov    ah,byte ptr [_CUR_DISP_X]
  116.         mov    al,byte ptr [_CUR_DISP_Y]
  117.         mov    [_CUR_OLD_XY],ax
  118.  
  119. int_rt_2:    mov    byte ptr [_ACT_DSP],0
  120. int_rt:        ret
  121. int_ent     endp
  122.  
  123. vs_set        proc    near
  124.         push    ds
  125.  
  126.         mov    ah,01h
  127.         mov    dl,IRQ_CODE
  128.         int    0AEh
  129.         mov    cs:[old_off],di
  130.         mov    cs:[old_seg],ds
  131.  
  132.         push    cs
  133.         pop    ds
  134.         mov    di,offset int_ent
  135.         mov    cs:[vs_off],di
  136.         mov    cs:[vs_seg],ds
  137.         mov    di,offset vs_para
  138.         mov    ah,00h
  139.         mov    dl,IRQ_CODE
  140.         int    0AEh
  141.  
  142.         mov    ah,03h
  143.         mov    di,offset irq_map
  144.         int    0AEh
  145.         or    byte ptr cs:[di+2],08h
  146.         mov    ah,02h
  147.         int    0AEh
  148.  
  149.         pop    ds
  150.         ret
  151. vs_set        endp
  152.  
  153. vs_reset     proc    near
  154.         push    ds
  155.  
  156.         push    cs
  157.         pop    ds
  158.         mov    ah,03h
  159.         mov    di,offset irq_map
  160.         int    0AEh
  161.         and    byte ptr cs:[di+2],0F7h
  162.         mov    ah,02h
  163.         int    0AEh
  164.  
  165.         mov    di,cs:[old_off]
  166.         mov    ds,cs:[old_seg]
  167.         mov    ah,00h
  168.         mov    dl,IRQ_CODE
  169.         int    0AEh
  170.  
  171.         pop    ds
  172.         ret
  173. vs_reset     endp
  174. ;******************************
  175. ;*    コンソ-ルBIOS(int 91h)
  176. ;******************************
  177. bios_ent     proc    far
  178.         pusha
  179.         push    ds    ;+2
  180.         push    es    ;+0
  181.         sti
  182.         cld
  183.         mov    bp,sp
  184.         mov    ds,cs:[ds_bak]
  185.         mov    es,cs:[es_bak]
  186.         mov    byte ptr [vdb_act_flg],1
  187.         push    ss
  188.         push    bp
  189.         call    _BIOS_91
  190.         add    sp,4
  191.         mov    byte ptr [vdb_act_flg],0
  192.         pop    es
  193.         pop    ds
  194.         popa
  195.         iret
  196. bios_ent     endp
  197. ;**************************************************************
  198. ;
  199. ;    ファイルのリダイレクト処理
  200. ;
  201. ; al    =    ファイルのオ-プンモ-ド
  202. ; bx    =    ファイルパス番号
  203. ; dx    =    NEWデバイスネ-ム
  204. ;
  205. ;**************************************************************
  206. reopen        proc    near
  207.         push    ax
  208.         mov    ah,3Eh                ; CLOSE
  209.         int    21h
  210.         pop    ax
  211.         mov    ah,3Dh                ; OPEN
  212.         int    21h
  213.         ret
  214. reopen        endp
  215. ;*********************************************
  216. ;*    コンソ-ルBIOSベクタ(int 91h) &
  217. ;*    タイマ割り込みの設定
  218. ;*********************************************
  219.         PUBLIC    _setbios
  220. _setbios     PROC     NEAR
  221.         push    ds
  222.         push    es
  223.  
  224.         mov     al,0                ; 標準入出力を
  225.         mov     bx,0                ; コンソ-ルデバイス
  226.         mov    dx,offset DGROUP:consol_path    ; にリダイレクトする
  227.         call    reopen                ; 入力
  228.         mov     al,1                ;
  229.         mov     bx,1                ;
  230.         call    reopen                ; 出力
  231.         mov     al,1                ;
  232.         mov     bx,2                ;
  233.         call    reopen                ; エラ-出力
  234.  
  235.         mov    cs:[ds_bak],ds
  236.         mov    cs:[es_bak],es
  237.  
  238.         mov    ax,3591h        ; int 91h
  239.         int    21h
  240.         mov    ax,es
  241.         mov    cs:[vct_seg],ax
  242.         mov    cs:[vct_off],bx
  243.  
  244.         mov    dx,offset bios_ent
  245.         push    cs
  246.         pop    ds
  247.         mov    ax,2591h        ; int 91h
  248.         int    21h
  249.  
  250.         call    oak_set
  251.         call    vs_set
  252.  
  253.         pop    es
  254.         pop    ds
  255.         ret    
  256. _setbios     endp
  257. ;***************************************
  258. ;*    ベクタ及び割り込みの解除 & 終了
  259. ;***************************************
  260.         PUBLIC    _resetbios
  261. _resetbios     PROC NEAR
  262.         push    ds
  263.         push    es
  264.  
  265.         mov    al,0                ; 標準入出力を
  266.         mov    bx,0                ; NULにリダイレクト
  267.         mov    dx,offset DGROUP:null_path    ;
  268.         call    reopen                ; 入力
  269.         mov    al,1                ;
  270.         mov    bx,1                ;
  271.         call    reopen                ; 出力
  272.         mov    al,1                ;
  273.         mov    bx,2                ;
  274.         call    reopen                ; エラ-出力
  275.  
  276.         call    vs_reset
  277.         call    oak_reset
  278.  
  279.         mov    ax,cs:[vct_seg]
  280.         mov    ds,ax
  281.         mov    dx,cs:[vct_off]
  282.         mov    ax,2591h
  283.         int    21h
  284.  
  285.         pop    es
  286.         pop    ds
  287.         ret    
  288. _resetbios     endp
  289. ;********************************************************
  290. ;*    swordset(short off,int word,int count,short seg);
  291. ;********************************************************
  292.         PUBLIC    _swordset
  293. _swordset    proc    near
  294.         push    bp
  295.         mov    bp,sp
  296.         push    es
  297.         push    di
  298.  
  299.         cld
  300.         mov    cx,[bp+8]
  301.         shr    cx,1
  302.         je    colst1
  303.  
  304.         mov    di,[bp+4]
  305.         mov    ax,[bp+10]
  306.         mov    es,ax
  307.  
  308.         mov    ax,[bp+6]
  309.     rep    stosw
  310.  
  311. colst1:        pop    di
  312.         pop    es
  313.         pop    bp
  314.         ret
  315. _swordset    endp
  316. ;*********************************************************
  317. ;*    smemcpy(short des,short src,int count,short seg1);
  318. ;*********************************************************
  319.         PUBLIC    _smemcpy
  320. _smemcpy     proc    near
  321.         push    bp
  322.         mov    bp,sp
  323.         push    ds
  324.         push    es
  325.         push    di
  326.         push    si
  327.  
  328.         cld
  329.         mov    cx,[bp+8]
  330.         shr    cx,1
  331.         je    vfcp1
  332.  
  333.         mov    di,[bp+4]
  334.         mov    si,[bp+6]
  335.         mov    ax,[bp+10]
  336.         mov    ds,ax
  337.         mov    es,ax
  338.  
  339.     rep    movsw
  340.  
  341. vfcp1:        pop    si
  342.         pop    di
  343.         pop    es
  344.         pop    ds
  345.         pop    bp
  346.         ret
  347. _smemcpy     endp
  348. ;********************************************************
  349. ;*    smemrcpy(char *src,char *des,int byte,short seg);
  350. ;********************************************************
  351.         PUBLIC    _smemrcpy
  352. _smemrcpy     proc    near
  353.         push    bp
  354.         mov    bp,sp
  355.         push    ds
  356.         push    es
  357.         push    di
  358.         push    si
  359.  
  360.         std
  361.         mov    cx,[bp+8]
  362.         shr    cx,1
  363.         je    vrcp1
  364.  
  365.         mov    di,[bp+4]
  366.         mov    si,[bp+6]
  367.         mov    ax,[bp+10]
  368.         mov    ds,ax
  369.         mov    es,ax
  370.  
  371.     rep    movsw
  372.  
  373. vrcp1:        cld
  374.         pop    si
  375.         pop    di
  376.         pop    es
  377.         pop    ds
  378.         pop    bp
  379.         ret
  380. _smemrcpy     endp
  381. ;*********************************
  382. ;*    int sjisto(int code);
  383. ;*********************************
  384.         PUBLIC    _sjisto
  385. _sjisto     proc    near
  386.         push    bp
  387.         mov    bp,sp
  388.         mov    ax,[bp+4]
  389.         shl    ah,1
  390.         cmp    al,080h
  391.         adc    ax,1f61h
  392.         add    al,7fh
  393.         jc    short knf1
  394.         add    al,0a2h
  395. knf1:        and    ah,7fh
  396.         pop    bp
  397.         ret
  398. _sjisto        endp
  399. ;*************************
  400. ;*    Beep();
  401. ;*************************
  402.         PUBLIC    _Beep
  403. _Beep        proc    near
  404.         push    dx
  405.         push    cx
  406.         mov    dx,0FF98h
  407.         in    al,dx
  408.         mov    cx,5000        ; x 10us
  409.         int    0FDh
  410.         out    dx,al
  411.         pop    cx
  412.         pop    dx
  413.         ret
  414. _Beep        ENDP
  415. ;********************************************
  416. ;*
  417. ;*    AsinKey(int ch,int byte,char *str)
  418. ;*
  419. ;********************************************
  420.         public    _AsinKey
  421. _AsinKey     proc    near
  422.         push    bp
  423.         mov    bp,sp
  424.         push    di
  425.  
  426.         mov    ax,0E00h    ; Assin String
  427.         mov    dx,[bp+4]    ; Key Code
  428.         mov    cx,[bp+6]    ; Str Count
  429.         mov    di,[bp+8]    ; Str Addr
  430.         int    90h        ; Key BIOS
  431.  
  432.         pop    di
  433.         pop    bp
  434.         ret
  435. _AsinKey     endp
  436. ;********************************************
  437. ;*
  438. ;*    KeyBufIns(short int *key,int len)
  439. ;*
  440. ;********************************************
  441.         public    _KeyBufIns
  442. _KeyBufIns     proc    near
  443.         push    bp
  444.         mov    bp,sp
  445.         push    di
  446.  
  447.         mov    ax,0B00h    ; Insert Key Buffer
  448.         mov    cx,[bp+6]    ; Str Count
  449.         mov    di,[bp+4]    ; Str Addr
  450.         int    90h        ; Key BIOS
  451.  
  452.         pop    di
  453.         pop    bp
  454.         ret
  455. _KeyBufIns     endp
  456. ;****************************************
  457. ; Wrt_Ank
  458. ;   al:char ah:attr
  459. ;   cx:x    bx:y
  460. ;****************************************
  461.         align    4
  462. _Wrt_Ank     proc    near
  463.         push    ds
  464.         push    si
  465.         push    es
  466.         push    di
  467.         push    cx
  468.         push    bx
  469.  
  470.         mov    dx,ax
  471.         sub    dh,dh        ; char=>ANKCG address [si]
  472.         shl    dx,4        ; * 16
  473.         mov    si,dx
  474.         mov    di,bx
  475.         add    di,cx
  476.  
  477.         mov    bl,ah
  478.         mov    cl,bl        ;cl
  479.         and    bx,7
  480.  
  481.         test    cl,20h        ;cl
  482.         je    $I147
  483.         or    bl,8        ;at
  484.  
  485. $I147:        test    cl,18h        ;cl
  486.         je    $I148
  487.         dec    bh        ;bk bh=0ffh
  488.  
  489. $I148:        mov    ax,ANKCG
  490.         mov    ds,ax
  491.  
  492.         mov    ax,GVRAM
  493.         mov    es,ax
  494.  
  495.         mov    dx,0FF99h
  496.         mov    al,01h
  497.         out    dx,al
  498.  
  499.         mov    al,0Fh
  500.         mov    dx,0FF81h
  501.         out    dx,al
  502.         mov    cx,80-1
  503.         cmp    al,bl
  504.         je    $Sclr
  505.  
  506.         sub    al,al
  507.  
  508.         REPT    16
  509.         stosb
  510.         add    di,cx
  511.         endm
  512.  
  513.         sub    di,80*16
  514.         mov    al,bl
  515.         out    dx,al
  516.  
  517. $Sclr:        or    bh,bh
  518.         jne    $FF100
  519.  
  520.         REPT    16
  521.         movsb
  522.         add    di,cx
  523.         endm
  524.         jmp    $FF101
  525.  
  526.         align    4
  527. $FF100:        REPT    16
  528.         lodsb
  529.         xor    al,bh
  530.         stosb
  531.         add    di,cx
  532.         endm
  533.  
  534. $FF101:        mov    dx,0FF99h
  535.         xor    al,al
  536.         out    dx,al
  537.  
  538.         pop    bx
  539.         pop    cx
  540.         pop    di
  541.         pop    es
  542.         pop    si
  543.         pop    ds
  544.         ret    
  545. _Wrt_Ank    ENDP
  546. ;************************************
  547. ; Wrt_Kan
  548. ;   dx:漢字(反転注意)    ah:attr
  549. ;   cx:x              bx:y
  550. ;************************************
  551.         align    4
  552. _Wrt_Kan     PROC NEAR
  553.         push    es
  554.         push    di
  555.         push    cx
  556.         push    bx
  557.  
  558.         mov    di,bx
  559.         add    di,cx        ;di=VRAM_Address
  560.         mov    cl,ah
  561.  
  562.         mov    bx,cx
  563.         mov    cx,dx
  564.         xchg    ch,cl
  565.  
  566. ;****** Bug Fix Start *******
  567.         cmp    ch,70h
  568.         jb    Not_Cnv
  569.         cmp    ch,74h
  570.         ja    Not_Cnv
  571.         cmp    cl,60h
  572.         jb    Not_Cnv
  573.         cmp    cl,7Eh
  574.         ja    Not_Cnv
  575.         add    cx,07C0h
  576.         jmp    Cnv_End
  577.  
  578.         align    4
  579. Not_Cnv:    cmp    ch,75h
  580.         je    Ext_Cnv
  581.         cmp    ch,76h
  582.         jne    Cnv_End
  583. Ext_Cnv:    sub    ch,75h
  584.         sub    cl,21h
  585.         mov    al,94
  586.         mul    ch
  587.         xor    ch,ch
  588.         add    ax,cx
  589.         mov    dx,ax
  590.         shr    dx,5     ; dx / 32
  591.         and    ax,1Fh    ; ax % 32
  592.         mov    ch,dl    ; dx * 256
  593.         mov    cl,al
  594.         add    cx,0900h
  595. Cnv_End:
  596. ;******* Bug Fix End ********
  597.  
  598.         xchg    ch,cl
  599.         mov    ax,cx
  600.         mov    cx,bx
  601.         mov    dx,0FF94h
  602.         out    dx,al
  603.         inc    dx
  604.         mov    al,ah
  605.         out    dx,al
  606.  
  607.         mov    bl,cl    ;cl
  608.         and    bx,7
  609.  
  610.         test    cl,20h    ;cl
  611.         je    $I247
  612.         or    bl,8            ;at
  613.  
  614. $I247:        test    cl,18h    ;cl
  615.         je    $I248
  616.         dec    bh            ;bk bh=0ffh
  617.  
  618. $I248:        mov    ax,GVRAM
  619.         mov    es,ax
  620.         mov    al,0Fh
  621.         mov    dx,0FF81h
  622.         out    dx,al
  623.         mov    cx,80-2
  624.         cmp    al,bl
  625.         je    $Sclr_K
  626.  
  627.         sub    ax,ax
  628.  
  629. $F251:        REPT    16
  630.         stosw
  631.         add    di,cx
  632.         endm
  633.  
  634.         sub    di,80*16
  635.         mov    al,bl
  636.         out    dx,al
  637.  
  638. $Sclr_K:    mov    dx,0FF96h+1
  639.         and    bh,bh
  640.         je    $FF200
  641.         jmp    $F277
  642.  
  643.         align    4
  644. $FF200:        REPT    16
  645.         dec    dx
  646.         insb
  647.         inc    dx
  648.         insb
  649.         add    di,cx
  650.         endm
  651.         jmp    $FF201
  652.  
  653.         align    4
  654.  
  655. $F277:        REPT    16
  656.         dec    dx
  657.         in    al,dx
  658.         xor    al,bh
  659.         stosb
  660.         inc    dx
  661.         in    al,dx
  662.         xor    al,bh
  663.         stosb
  664.         add    di,cx
  665.         endm
  666.  
  667. $FF201:        pop    bx
  668.         pop    cx
  669.         pop    di
  670.         pop    es
  671.         ret    
  672. _Wrt_Kan    ENDP
  673. ;*****************************
  674. ; locate
  675. ;*****************************
  676.         PUBLIC    _locate
  677. _locate        proc    near
  678.         push    es
  679.         mov    cx,[_CUR_DISP_X]
  680.         mov    bx,[_CUR_DISP_Y]
  681.         mov    ax,MAX_X
  682.         mul    bx
  683.         add    ax,cx
  684.         shl    ax,1
  685.         add    ax,offset dmy_ram
  686.         mov    di,ax
  687.         xor    byte ptr cs:[di+1],0FFh
  688.  
  689.         shl    bx,4        ; y *= 16
  690.         add    bx,[_CUR_DISP_OFF]
  691.         mov    ax,80
  692.  
  693.         mul    bx        ; y *= 80
  694.         add    ax,cx        ; y + x
  695.         mov    di,ax
  696.  
  697.         mov    ax,GVRAM
  698.         mov    es,ax
  699.         mov    dx,0FF81h
  700.         mov    al,00000001b
  701.         call    loca_sub
  702.         mov    al,01000010b
  703.         call    loca_sub
  704.         mov    al,10000100b
  705.         mov    al,10000100b
  706.         call    loca_sub
  707.         mov    al,11001000b
  708.         call    loca_sub
  709.         pop    es
  710.         ret    
  711.  
  712. loca_sub:    out    dx,al
  713.         push    di
  714.         mov    cx,[_CUR_DISP_SIZ]
  715.  
  716. loca1:        not    byte ptr es:[di]
  717.         add    di,80
  718.         loop    loca1
  719.         pop    di
  720.         ret
  721. _locate        ENDP
  722. ;***********************************************
  723. ;仮想VRAM部(DMYCON Ver2.03)
  724. ;                             by (山)
  725. ;***********************************************
  726.         public    _cflush
  727. _cflush        proc     near
  728.         push    es
  729.         push    ds
  730.         cld
  731.  
  732.         mov    ds,cs:[_ACT_CVRAM]    ; cp
  733.         xor    si,si
  734.  
  735.         mov    ax,cs        ; dp
  736.         mov    es,ax
  737.         mov    di,offset dmy_ram
  738.  
  739.         xor    cx,cx        ; x:cx
  740.         xor    bx,bx        ; y:bx
  741.         align    4
  742.  
  743. cf_lp1:        mov    ax,[si]
  744.         test    ah,40h
  745.         je    short cf_ank
  746.  
  747.         mov    ds,cs:[_ACT_KVRAM]
  748.         mov    dx,[si]
  749.         mov    ds,cs:[_ACT_CVRAM]
  750.  
  751.         cmp    dh,es:[di+0]
  752.         jne    short cf_knj
  753.         cmp    dl,es:[di+2]
  754.         jne    short cf_knj
  755.         cmp    ah,es:[di+1]
  756.         je    short cf_ked
  757.  
  758. cf_knj:        mov    es:[di+1],ah
  759.         mov    es:[di+0],dh
  760.         mov    es:[di+2],dl
  761.         mov    byte ptr es:[di+3],0BFh
  762.         call    _Wrt_Kan
  763. cf_ked:        add    si,4
  764.         add    di,4
  765.         add    cx,2
  766.         jmp    short cf_end
  767.         align    4
  768.  
  769. cf_ank:        cmp    ax,es:[di]
  770.         stosw
  771.         je    short cf_aed
  772.         call    _Wrt_Ank
  773. cf_aed:        add    si,2
  774.         inc    cx
  775.  
  776. cf_end:        cmp    cx,MAX_X
  777.         jb    short cf_lp1
  778.         sub    cx,MAX_X
  779.         add    bx,80*LINSIZ
  780.         cmp    bx,MAX_Y2*80*LINSIZ
  781.         jb    short cf_lp1
  782.  
  783.         pop    ds
  784.         pop    es
  785.         cmp    byte ptr [_CUR_DISP_FLG],0
  786.         jne    short cf_end2
  787.         call    _locate
  788. cf_end2:    ret
  789. _cflush        endp
  790.  
  791. _TEXT        ENDS
  792. END
  793.